package cn.edu.cxcyzx.util;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author zxl
 * @date   2018年6月5日下午7:51:15
 * @描述:	自定义json格式
 *	
 */
public class MsgJSON {
	
	private int code;//100:成功，200失败
	private String msg;//提示信息
	private Map<String,Object>  extend=new HashMap<String,Object> ();
	public MsgJSON(){}
	public MsgJSON add(String key,Object value){
		this.getExtend().put(key, value);
		return this;
	}
	public static MsgJSON success(){
		MsgJSON result=new MsgJSON();
		result.setCode(100);
		result.setMsg("处理成功");
		return result;
	}
	
	public static MsgJSON fail(){
		MsgJSON result=new MsgJSON();
		result.setCode(200);
		result.setMsg("处理失败");
		return result;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Map<String, Object> getExtend() {
		return extend;
	}
	public void setExtend(Map<String, Object> extend) {
		this.extend = extend;
	}
	
	
}
